let $tool = {
    // 获取url参数
    getUrlQuery (variable) {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == variable) { return decodeURI(pair[1]); }
        }
        return (false);
    },
    //判断是否是PC端
    IsPC () {
        var userAgentInfo = navigator.userAgent;
        var Agents = ["Android", "iPhone",
            "SymbianOS", "Windows Phone",
            "iPad", "iPod"];
        var flag = true;
        for (var v = 0; v < Agents.length; v++) {
            if (userAgentInfo.indexOf(Agents[v]) > 0) {
                flag = false;
                break;
            }
        }
        return flag;
    },
    //防抖函数
    debounce (fn, delay) {
        let timer = null
        return function () {
            if (timer) {
                clearTimeout(timer)
            }
            timer = setTimeout(fn, delay)
        }
    },
    //节流函数
    throttle (fn, delay) {
        let flag = true
        return function () {
            if (!flag) {
                return false
            }
            flag = false
            setTimeout(() => {
                fn()
                flag = true
            }, delay)
        }
    },
}